/// <reference path="./../custom-typings/index.d.ts" />

import 'antd/dist/antd.less';
import './asset/style/main.scss';

import * as React from 'react';
import * as ReactDOM from 'react-dom';
import * as Immutable from 'seamless-immutable'
import { createStore, applyMiddleware, compose } from 'redux';
import { Provider } from 'react-redux';
import thunkMiddleware from 'redux-thunk';
import reducer from './reducer/reducer';

import Workflow from './page/workflow/Workflow';

const composeEnhancers = (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const preloadedState = {};

// 创建一个中间件集合
// const middleware = [thunkMiddleware, loggerMiddleware]
const middleware = [thunkMiddleware];

const store = createStore<any>(
    reducer,
    preloadedState,
    composeEnhancers(applyMiddleware(...middleware))
);


window.onload = function () {
    ReactDOM.render(
        <Provider store={store}>
            <Workflow />
        </Provider>,
        document.getElementById('app-placeholder')
    );
};
